// Sample program to show how different functions from the
// standard library use the io.Writer interface.
package main

import (
	"bytes"
	"fmt"
	"os"
)

// main is the entry point for the application.
func main() {
	// Create a Buffer value and write a string to the buffer.
	// Using the Write method that implements io.Writer.
	var b bytes.Buffer //MARK 实现了io.Writer接口 就是说 有"Write(p []byte) (n int, err error)" 这个方法
	b.Write([]byte("Hello "))

	//MARK b后面追加
	fmt.Fprintf(&b, "World!") //MARK 方法的第一个参数是io.Writer

	b.WriteTo(os.Stdout) //MARK 这个方法 接受io.Writer, 就是说os.Stdout 有"Write(p []byte) (n int, err error)" 这个方法
}
